Skip to content

cabal2nix/FromCabal.License: use getLicenseFromSpdxId for SPDX licenses#708

Merged
sternenseemann merged 1 commit intomasterfrom
spdx-fallback
Mar 21, 2026
Merged

cabal2nix/FromCabal.License: use getLicenseFromSpdxId for SPDX licenses#708
sternenseemann merged 1 commit intomasterfrom
spdx-fallback

Conversation

@sternenseemann
Copy link
Copy Markdown
Member

Nixpkgs' lib.licenses does not actually contain all SPDX licenses, as stated in the upstream documentation
https://nixos.org/manual/nixpkgs/stable/#function-library-lib.meta.licensesSpdx.

Instead of (again) tracking which licenses are in Nixpkgs and which aren't we can simply use the lib.meta.getLicenseFromSpdxId function which returns a fallback value if the SPDX license id is unknown to Nixpkgs.

@maralorn
Copy link
Copy Markdown
Member

I like it. I wished we could have a good fallback solution when parsing from cabal as well.

Nixpkgs' lib.licenses does not actually contain all SPDX licenses, as stated
in the upstream documentation
<https://nixos.org/manual/nixpkgs/stable/#function-library-lib.meta.licensesSpdx>.

Instead of (again) tracking which licenses are in Nixpkgs and which aren't we can
simply use the `lib.meta.getLicenseFromSpdxId` function which returns a fallback
value if the SPDX license id is unknown to Nixpkgs.
@sternenseemann
Copy link
Copy Markdown
Member Author

good fallback solution

As said, we have some data on SPDX licenses, e.g. the full name. We could generate a decent fallback set with the id, the full title and maybe a link to spdx.org, but I think it would be a problematic increase in code size for Nixpkgs where we would never need the fallback.

@sternenseemann sternenseemann merged commit 6a39401 into master Mar 21, 2026
7 checks passed
@sternenseemann sternenseemann deleted the spdx-fallback branch March 21, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants